Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support conditional operators #1939

Merged
merged 10 commits into from
May 17, 2022
Merged

feat: support conditional operators #1939

merged 10 commits into from
May 17, 2022

Conversation

AlexVarchuk
Copy link
Collaborator

@AlexVarchuk AlexVarchuk commented Mar 22, 2022

What/Why/How?

add support conditional operators for openApi 3.1. Add supporting x-displayName for if/else.

Reference

properties:
  photoUrls:
    description: The list of URL to a cute photos featuring pet
    type: [string, integer, 'null', array]
    xml:
      name: photoUrl
      wrapped: true
    items:
      type: string
      format: url
    if:
      x-displayName: isString
      type: string
    then:
      minItems: 1
      maxItems: 10
    else:
      x-displayName: notString
      type: [integer, 'null', array]
      minItems: 1
      maxItems: 20
properties:
  userStatus:
    description: User status
    type: integer
    format: int32
if:
  title: userStatus === 10
  properties:
    userStatus:
      enum: [10]
then:
  required: ['phone']
else:
  required: []

Testing

Screenshots (optional)

Screenshot 2022-05-16 at 18 56 00

Screenshot 2022-05-16 at 18 56 15

Screenshot 2022-05-16 at 18 56 29

Check yourself

  • Code is linted
  • Tested
  • All new/updated code is covered with tests

@RomanHotsiy RomanHotsiy added this to the v2.0 milestone Mar 22, 2022
@AlexVarchuk AlexVarchuk changed the title Feat: support conditional operators feat: support conditional operators Mar 23, 2022
@AlexVarchuk AlexVarchuk marked this pull request as ready for review March 23, 2022 15:40
@AlexVarchuk
Copy link
Collaborator Author

after merge #1942 unit test should be passed

@AlexVarchuk AlexVarchuk requested a review from a team as a code owner May 13, 2022 11:14
src/services/OpenAPIParser.ts Outdated Show resolved Hide resolved
src/services/OpenAPIParser.ts Outdated Show resolved Hide resolved
src/services/models/Schema.ts Outdated Show resolved Hide resolved
src/services/models/Schema.ts Outdated Show resolved Hide resolved
src/services/models/Schema.ts Outdated Show resolved Hide resolved
src/components/Fields/Field.tsx Outdated Show resolved Hide resolved
src/utils/openapi.ts Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants